package org.example.synchronizeddemo;

/**
 * 丢失请求1
 */
public class DisappearRequest1 implements Runnable {

  public static final Object object = new Object();
  static int i = 0;

  public static void main(String[] args) throws InterruptedException {
    Thread thread = new Thread(new DisappearRequest1());
    thread.start();

    Thread thread2 = new Thread(new DisappearRequest1());
    thread2.start();

    thread.join();
    thread2.join();
    System.out.println(i);

  }

  @Override
  public void run() {
    synchronized (object) {
      for (int i1 = 0; i1 < 10000; i1++) {
        i++;
      }
    }
  }
}
